strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
    ("Select * from CIM_DataFile where Drive = 'D:' and Extension = 'epf' and Path like '\\1cTests\\bin\\%'")

Set WshShell = WScript.CreateObject("WScript.Shell")
command = WshShell.CurrentDirectory & "\V8Unpack.exe -PARSE "
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(WshShell.CurrentDirectory & "\src") Then
	objFSO.DeleteFolder(WshShell.CurrentDirectory & "\src")
	objFSO.CreateFolder(WshShell.CurrentDirectory & "\src")
End If

Set f = objFSO.GetFolder(WshShell.CurrentDirectory & "\bin")
Set fc = f.SubFolders
For Each fold1 in fc
	path = WshShell.CurrentDirectory & "\src\" & fold1.name
	On Error Resume Next
	objFSO.CreateFolder(path) 
Next

For Each objFile in colFiles
	File = objFSO.GetFile(objFile.name)
	Folder = objFSO.GetFolder(objFSO.GetParentFolderName(File))
'	WScript.echo objFSO.GetBaseName(Folder)
	if not objFSO.GetBaseName(Folder) = "Units" then
	
		comm = command & objFile.name & " " & Replace(objFSO.GetParentFolderName(File),"bin","src") & "\" & objFSO.GetBaseName(File)
		WshShell.run comm,0,1

	end if
Next

